/*
 * @Author: Swance
 * @Date: 2023-12-14
 * @Description: 防抖函数
 */
export const useDebounce = (that: any, fn: Function, delay: number) => {
  let timer: any = null;
  return function (...args: any[]) {
    if (timer) {
      clearTimeout(timer);
    }
    timer = setTimeout(() => {
      fn.apply(that, ...args);
    }, delay);
  };
};
